﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RPG
{
    class Weapon
    {
        private WeaponTag weaponTag;
        public Weapon(WeaponTag weapon)
        {
            weaponTag = weapon;
        }
        private Random _random = new Random();
        public void Attack(WeaponTag weapon, Monster monster)
        {
            switch (weapon)
            {
                case WeaponTag.BackSwork:
                    monster.HP -= 20;
                    Console.WriteLine("攻击成功！");
                    monster.Hit();
                    break;
                case WeaponTag.IronSwork:
                    monster.HP -= 50;
                    Console.WriteLine("攻击成功！");
                    monster.Hit();
                    break;
                case WeaponTag.Shadowbane:
                    monster.HP -= _random.NextDouble() < 0.5 ? 100 : 200;
                    Console.WriteLine("攻击成功！");
                    monster.Hit();
                    break;
                default:
                    Console.WriteLine("手里没有武器不能攻击");
                    break;                 
            }
        }
    }
    public enum WeaponTag
    {
        /// <summary>
        /// 木剑
        /// </summary>
        BackSwork = 1,
        /// <summary>
        /// 铁剑
        /// </summary>
        IronSwork = 2,
        /// <summary>
        /// 魔剑
        /// </summary>
        Shadowbane  = 3,
        /// <summary>
        /// 没武器
        /// </summary>
        Nothing = 0 

    }
}
